//
//  PizzaStore.m
//  Charles
//
//  Created by Charles on 2017/6/15.
//  Copyright © 2017年 charles. All rights reserved.
//

#import "PizzaStore.h"

@implementation NYStylePizzaStore

- (Pizza *)orderPizza:(PizzaType)type {
    Pizza *pizza = [self createPizza:type];
    [pizza prepare];
    [pizza bake];
    [pizza cut];
    [pizza box];
    return pizza;
}

- (Pizza *)createPizza:(PizzaType)type {
    Pizza * pizza = nil;
    if (type == PizzaTypeCheese) {
        pizza = [[NYCheesePizza alloc]init];
    }else if (type == PizzaTypePepperoni) {
        pizza = [[NYPepperoniPizza alloc]init];
    }else if (type == PizzaTypeClam) {
        pizza = [[NYClamPizza alloc]init];
    } else if (type == PizzaTypeVeggie) {
        pizza = [[NYVeggiePizza alloc]init];
    }
    return pizza;
}

@end

@implementation CLNYStylePizzaStore

- (CLPizza *)orderPizza:(PizzaType)type {
    CLPizza *pizza = [self createPizza:type];
    [pizza prepare];
    [pizza bake];
    [pizza cut];
    [pizza box];
    return pizza;
}
- (CLPizza *)createPizza:(PizzaType)type {
    CLPizza * pizza = nil;
    id<PizzaIngredientFactory>factory = [[NYPizzaIngredientFactory alloc]init];
    if (type == PizzaTypeCheese) {
        pizza = [[CheesePizza alloc]initWithFactory:factory];
    }else if (type == PizzaTypePepperoni) {
//        pizza = [[NYPepperoniPizza alloc]init];
    }else if (type == PizzaTypeClam) {
//        pizza = [[NYClamPizza alloc]init];
    } else if (type == PizzaTypeVeggie) {
//        pizza = [[NYVeggiePizza alloc]init];
    }
    return pizza;
}


@end
